//Created by Kyle "Fayt" Lowry
//Menu.h

#pragma once

#include "SpriteInfo.h"
#include "Definitions.h"
#include "ENUM.h"
#include "Button.h"
#include "sound.h"
#include "Text.h"
#include "Globals.h"

class Sprite;
class Input;

class Menu
{
private:
	Sprite*		sprite;
	SpriteInfo	MenuSprite[NUM_MENU_SPRITES];		//Sprite information object used to load sprites for the menu (such as background image and button images)
	SpriteInfo	playerChoice[NUM_PLAYERS];			//Sprite information object for when the character has been selected
	SpriteInfo	menuBanner;							//Sprite information object that will be the banner used for any parts of the menu that it is needed
	SpriteInfo	ourPicture[NUM_PROGRAMMER_PICS];	//Sprite information object that will be the game programmers pictures in the credits
	SpriteInfo	fontBackground;						//Sprite information for a square to place font on
	Input*		MenuInput;							//Input for the menu such as mouse clicks and key presses
	Button		button[NUM_MENU_BUTTONS];			//Button array for all the menu buttons
	Button		selectedButton;						//Button object that represents a selected menu button (the mouse is over it)
	Button		playerPic[NUM_PLAYERS];				//Button array that represents the player pictures that can be chosen
	Text*		text;								//Font object that will be used for the text on the menu buttons
	char		buffer[64];							//Buffer to write to and than send to the font object to write to the screen
	int			numPlayers;							//Number of players that will be playing
	int*		playerOrder;						//The order of the players depending on the characters they choose
	bool		picked[NUM_PLAYERS];				//Used to check if the player picture has been chosen already
	int			index;
	int			menuState;							//Used to dictate which state the menu is in
	int			creditState;						//Used to dictate which page the credits screen is currently on

private:
#ifdef USING_SOUND
	sound Sound;
	bool soundToPlay[NUM_MENU_SOUNDS];
#endif

public:
	//////////////////////////////////////////////////////////////////////////
	// Name:		Init
	// Parameters:	Sprite*	- Sends in the one and only sprite object to use
	//						  to render the menu's sprites
	//				Input*	- Sends in the input object to use input when
	//						  the player is in the menu state
	// Return:		void
	// Description: This function is run when the menu is entered but only
	//				runs once per game and will set up any objects that are
	//				needed for the main menu.
	//////////////////////////////////////////////////////////////////////////
	void Init(Sprite*, Input*);

	//////////////////////////////////////////////////////////////////////////
	// Name:		Update
	// Parameters:	void
	// Return:		CONTROLLER_STATE
	// Description: This is run every frame. It is used to update menu
	//				variables as well as process input for the menu
	//////////////////////////////////////////////////////////////////////////
	CONTROLLER_STATE Update();

	//////////////////////////////////////////////////////////////////////////
	// Name:		Render
	// Parameters:	void
	// Return:		void
	// Description: This is run every frame. It is used to draw any menu
	//				sprites or meshes if needed
	//////////////////////////////////////////////////////////////////////////
	void Render();

	//////////////////////////////////////////////////////////////////////////
	// Name:		Release
	// Parameters:	void
	// Return:		void
	// Description: This function is run when the menu is exited and will
	//				destroy any objects that are not needed for the other
	//				game states.
	//////////////////////////////////////////////////////////////////////////
	void Release();

};